<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>文章添加--layui后台管理模板</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="../../css/font_eolqem241z66flxr.css" media="all" />
	<script src="../../jquery-3.3.1/jquery-3.3.1.js"></script>
	<script src="../../jquery-3.3.1/jquery-3.3.1.min.js"></script>
	<script type="text/javascript" src="../../../tool/ajax.js"></script>

</head>
<body class="childrenBody">
	<form class="layui-form" style="display: flex;flex-direction: column;align-content: center">
		<div class="layui-form-item">
			<label class="layui-form-label">ID</label>
			<div class="layui-input-block">
				<input type="text"  id="userid" value="" class="layui-input newsName" lay-verify="required" placeholder="ID"  disabled="true" >
			</div>
		</div>
		<!--<div class="layui-form-item">-->
			<!--<label class="layui-form-label">Openid</label>-->
			<!--<div class="layui-input-block">-->
				<!--<input type="text" id="openid" class="layui-input newsName" lay-verify="required"   placeholder="openid"  >-->
			<!--</div>-->
		<!--</div>-->

		<!--<div class="layui-form-item">-->
			<!--<label class="layui-form-label">姓名</label>-->
			<!--<div class="layui-input-block">-->
				<!--<input type="text" id="name" class="layui-input newsName" lay-verify="required"   placeholder="姓名"  >-->
			<!--</div>-->
		<!--</div>-->

		<div class="layui-form-item">
			<label class="layui-form-label">所在地区</label>
			<div class="layui-input-block">
				<input type="text" id="area" class="layui-input newsName" lay-verify="required" placeholder="所在地区"
					  >
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">抽奖次数</label>
			<div class="layui-input-block">
				<input type="text" id="lotterynum" class="layui-input newsName" lay-verify="required" placeholder="抽奖次数"
				>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">是否分享</label>
			<div class="layui-input-block">
				<input type="text" id="share" class="layui-input newsName" lay-verify="required" placeholder="是否分享"
				>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">分享次数</label>
			<div class="layui-input-block">
				<input type="text" id="sharenum" class="layui-input newsName" lay-verify="required" placeholder="分享次数"
				>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">客服人员</label>
			<div class="layui-input-block">
				<input type="text" id="servicesname" class="layui-input newsName" lay-verify="required" placeholder="客服人员"
				>
			</div>
		</div>
			<div   style="width:20%;margin: 0 auto;" ><!--水平居中-->
		<button
				type="button"   onclick="edituser()"   class="layui-btn layui-btn-normal layui-btn-radius">提交信息
		</button>
			</div>

	</form>
	<script type="text/javascript" src="../../layui/layui.js"></script>
	<script type="text/javascript" src="useredit.js"></script>

</body>

<script>
    function edituser() {
        var sharetemp=null;
		var userid=document.getElementById('userid').placeholder;
        var servicesname = document.getElementById("servicesname").value;
       var sharenum = document.getElementById("sharenum").value;
       var share = document.getElementById("share").value;
        var address=document.getElementById("area").value;
      var lotterynum=document.getElementById("lotterynum").value

		if(share=="是"){
            sharetemp=1;
		}else if(share=="否"){
            sharetemp=0;
		}
        ajaxpost("system/update", { id:userid,zone:address,lotterynum:lotterynum,share:sharetemp,sharenum:sharenum,servicesname:servicesname}, function (data) {
            try {
                console.log("服务器请求会发")
                if (data.code == 200) {
                    layer.msg('编辑成功', {
                        icon: 1,
                        time: 2000 //2秒关闭（如果不配置，默认是3秒）
                    }, function () {
                        // parent.location.reload();  //刷新
                    });
                } else {
                    layer.msg('编辑失败', {
                        icon: 0,
                        time: 2000 //2秒关闭（如果不配置，默认是3秒）
                    }, function () {

                        // parent.location.reload();
                    });
                }
            } catch (e) {
                layer.msg('编辑失败', {
                    icon: 0,
                    time: 2000 //2秒关闭（如果不配置，默认是3秒）
                }, function () {
                    // parent.location.reload();
                });
            }
        })
    }


</script>
</html>